export function getAllWeak(start_time, end_time) {
  var begin = new Date(start_time),
    end = new Date(end_time);
  var begin_time = begin.getTime(),
    end_time = end.getTime(),
    time_diff = end_time - begin_time;
  var all_d = [];
  for (var i = 0; i <= time_diff; i += 86400000) {
    var ds = new Date(begin_time + i);
    var year = ds.getFullYear();
    var month = ds.getMonth() + 1;
    var day = ds.getDate();
    if (month < 10) {
      month = "0" + month;
    }
    if (day < 10) {
      day = "0" + day;
    }
    all_d.push(year + "-" + month + "-" + day);
  }
  return all_d;
}

//与当前时间比较大小
export function timeAfterNow(date1) {
  let oDate1 = new Date(date1);
  let oDate2 = new Date();
  return oDate1.getTime() >= oDate2.getTime();
}

// 获取指定月份的第一天
export function getCurrentMonthFirstDay(param) {
  var date = new Date(param);
  date.setDate(1);
  var month = parseInt(date.getMonth() + 1);
  var day = date.getDate();
  if (month < 10) {
    month = "0" + month;
  }
  if (day < 10) {
    day = "0" + day;
  }
  return date.getFullYear() + "-" + month + "-" + day;
}

// 获取指定月份的最后一天
export function getCurrentMonthLastDay(param) {
  var date = new Date(param);
  var currentMonth = date.getMonth();
  var nextMonth = ++currentMonth;
  var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
  var oneDay = 1000 * 60 * 60 * 24;
  var lastTime = new Date(nextMonthFirstDay - oneDay);
  var month = parseInt(lastTime.getMonth() + 1);
  var day = lastTime.getDate();
  if (month < 10) {
    month = "0" + month;
  }
  if (day < 10) {
    day = "0" + day;
  }
  return date.getFullYear() + "-" + month + "-" + day;
}
